package com.fjnldx.mes.controller.scheduling;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjnldx.mes.domain.domainReq.*;
import com.fjnldx.mes.domain.domainRes.Result;
import com.fjnldx.mes.domain.domainRes.Results;
import com.fjnldx.mes.domain.pojo.*;
import com.fjnldx.mes.service.scheduling.SchedulingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/scheduling/personnel")
@Api(value = "人员排班", tags = "人员排班")
public class SchedulingController {
    @Resource
    SchedulingService schedulingService;

    @GetMapping("/addPeopleCascadeRelationship")
    @ApiOperation(value = "查询级联关系-集团-组织-车间-工序-工种（树顶传groupTreeTop）", notes = "查询级联关系-集团-组织-车间-工序-工种（树顶传groupTreeTop）")
    public Result addPeopleCascadeRelationship(String keyName) {
        return schedulingService.addPeopleCascadeRelationship(keyName);
    }

    @GetMapping("/getShiftInformation")
    @ApiOperation(value = " 获取班次信息-班长-班教练", notes = " 获取班次信息-班长-班教练")
    public Result getShiftInformation(SchedulingClassesInfoQuery params) {
        return schedulingService.getShiftInformation(params);
    }

    @GetMapping("/getEquipmentByGx")
    @ApiOperation(value = "获取工序设备号", notes = "获取工序设备号")
    public Result getEquipmentByGx(GongXu params) {
        return schedulingService.getEquipmentByGx(params);
    }

    @GetMapping("/getDevSnSelectedStatus")
    @ApiOperation(value = "获取机台选择状态", notes = "获取机台选择状态")
    public Result getDevSnSelectedStatus(DevSnSelectedStatusReq params) {
        return schedulingService.getDevSnSelectedStatus(params);
    }

    @PostMapping("/queryPersonnelGroup")
    @ApiOperation(value = "人员管理-集团-级联", notes = "人员管理-集团-级联")
    public Result queryPersonnelGroup() throws Exception {
        return schedulingService.queryPersonnelGroup();
    }

    @PostMapping("/queryPersonnelGroupAndOrg")
    @ApiOperation(value = "人员管理-集团-组织-级联", notes = "人员管理-集团-组织-级联")
    public Result queryPersonnelGroupAndOrg(@RequestBody Group data) throws Exception {
        return schedulingService.queryPersonnelGroupAndOrg(data);
    }

    @GetMapping("/queryPersonnelClasses")
    @ApiOperation(value = "查询人员排班记录", notes = "查询人员排班记录")
    public Results queryPersonnelClasses(SchedulingReq data) {
        return schedulingService.queryPersonnelClasses(data);
    }

    @PostMapping("/queryPersonnelClassesLt")
    @ApiOperation(value = "查询人员排班记录络筒", notes = "查询人员排班记录络筒")
    public Result queryPersonnelClassesLt(@RequestBody SchedulingReq data) {
        return schedulingService.queryPersonnelClassesLt(data);
    }

    @PostMapping("/deletePersonnelClasses")
    @ApiOperation(value = "移除该人员排班", notes = "移除该人员排班")
    public Result deletePersonnelClasses(@RequestBody SchedulingReqOfName data) {
        return schedulingService.deletePersonnelClasses(data);
    }

    @PostMapping("/updateMesLscsBatch")
    @ApiOperation(value = "更新落纱次数-批量", notes = "更新落纱次数-批量")
    public Result updateMesLscsBatch(@RequestBody UpdateLscsReq data) {
        return schedulingService.updateMesLscsBatch(data);
    }

    @PostMapping("/updateMesLscsSingle")
    @ApiOperation(value = "更新落纱次数-单独-根据机台号[增行1，减行2，编辑3](整行无id，减行，编辑必须传id)", notes = "更新落纱次数-单独-根据机台号[增行1，减行2，编辑3](整行无id，减行，编辑必须传id)")
    public Result updateMesLscsSingle(@RequestBody UpdateLscsSingleReq data) {
        return schedulingService.updateMesLscsSingle(data);
    }

    @PostMapping("/queryMesLscs")
    @ApiOperation(value = "查询落纱次数信息", notes = "查询落纱次数信息")
    public Result queryMesLscs(@RequestBody InputChangeReq data) throws InterruptedException {
        return schedulingService.queryMesLscs(data);
    }

    @PostMapping("/queryReplaceInfoCsDs")
    @ApiOperation(value = "查询各队换粗纱锭数明细", notes = "查询各队换粗纱锭数明细")
    public Result queryReplaceInfoCsDs(@RequestBody InputChangeReq data) {
        return schedulingService.queryReplaceInfoCsDs(data);
    }

    @PostMapping("/updateReplaceCsDs")
    @ApiOperation(value = "换粗纱段数更新", notes = "换粗纱段数更新")
    public Result updateReplaceCsDs(@RequestBody UpdateReplaceCsDsReq data) {
        return schedulingService.updateReplaceCsDs(data);
    }

    @PostMapping("/queryScheduleYesterday")
    @ApiOperation(value = "一键复制昨日人员排班", notes = "一键复制昨日人员排班")
    public Result queryScheduleYesterday(@RequestBody CopyBc data) {
        return schedulingService.queryScheduleYesterday(data);
    }

    @PostMapping("/addPersonnelClasses")
    @ApiOperation(value = "新增人员排班", notes = "新增人员排班")
    public Result addPersonnelClasses(@RequestBody AddScheduling data) throws Exception {
        return schedulingService.addPersonnelClasses(data);
    }

    @PostMapping("/modifyPersonnelClasses")
    @ApiOperation(value = "修改人员排班", notes = "修改人员排班")
    public Result modifyPersonnelClasses(@RequestBody SchedulingShow data) {
        return schedulingService.modifyPersonnelClasses(data);
    }

    @PostMapping("/modifyPersonnelClassesLt")
    @ApiOperation(value = "修改人员排班络筒", notes = "修改人员排班络筒")
    public Result modifyPersonnelClassesLt(@RequestBody ModifyScheduling data) {
        return schedulingService.modifyPersonnelClassesLt(data);
    }

    @PostMapping("/modifyDailyPlanLtDs")
    @ApiOperation(value = "修改人员排班络筒锭数", notes = "修改人员排班络筒锭数")
    public Result modifyDailyPlanLtDs(@RequestBody Id2 data) {
        return schedulingService.modifyDailyPlanLtDs(data);
    }

    @GetMapping("/getDsSelectedStatus")
    @ApiOperation(value = "查询络筒锭数选择状态", notes = "查询络筒锭数选择状态")
    public Result getDsSelectedStatus(DsSelectedStatusReq data) {
        return schedulingService.getDsSelectedStatus(data);
    }

    @PostMapping("/addPersonnel")
    @ApiOperation(value = "新增人员信息（单个）", notes = "新增人员信息（单个）")
    public Result addPersonnel(@RequestBody SchedulingPersonnel data) throws Exception {
        return schedulingService.addPersonnel(data);
    }

    @PostMapping("/modifyPersonnel")
    @ApiOperation(value = "修改人员信息", notes = "修改人员信息")
    public Result modifyPersonnel(@RequestBody SchedulingPersonnel data) throws Exception {
        return schedulingService.modifyPersonnel(data);
    }

    @PostMapping("/deletePersonnel")
    @ApiOperation(value = "删除人员信息", notes = "删除人员信息")
    public Result deletePersonnel(@RequestBody String[] array) throws Exception {
        return schedulingService.deletePersonnel(array);
    }

    @GetMapping("/queryPersonnel")
    @ApiOperation(value = "多条件查询人员信息", notes = "多条件查询人员信息")
    public Result queryPersonnel(SchedulingPersonnel data, Page<SchedulingPersonnel> page) throws Exception {
        return schedulingService.queryPersonnel(data, page);
    }

    @PostMapping("/oneClickDelete")
    @ApiOperation(value = "一键删除排班", notes = "一键删除排班")
    public Result oneClickDelete(@RequestBody ScheReqParams data) {
        return schedulingService.oneClickDelete(data);
    }

    @PostMapping("/copyToSchedulingTemplate")
    @ApiOperation(value = "复制到排班模板", notes = "复制到排班模板")
    public Result copyToSchedulingTemplate(@RequestBody ScheReqParams data) {
        return schedulingService.copyToSchedulingTemplate(data);
    }

    @PostMapping("/queryNoTypeOfWorkInModel")
    @ApiOperation(value = "查询所有工序无对应机台工种", notes = "查询所有工序无对应机台工种")
    public Result queryNoTypeOfWorkInModel(@RequestBody NoTypeOfWorkInModel data) {
        return schedulingService.queryNoTypeOfWorkInModel(data);
    }

}
